import {
  Body,
  Controller,
  Get,
  HttpCode,
  HttpStatus,
  Param, Post,
} from '@nestjs/common';
import { ApiOkResponse, ApiOperation, ApiTags } from '@nestjs/swagger';
import { UserService } from './user.service';
import { QueryUserListVo } from './queryUserList.vo';
import { UserEntity } from '@src/modules/Employee/User.entity';

@ApiTags('测试')
@Controller('testUser')
export class TestUserController {
  constructor(private readonly userService: UserService) {
  }

  @ApiOperation({ summary: '查询单个用户', description: '查询单个用户' })
  @ApiOkResponse({
    type: QueryUserListVo,
    description: '查询单个用户',
  })
  @Get('query/:userID')
  @HttpCode(HttpStatus.CREATED)
  async queryUser(@Param('userID') userID: string) {
    return this.userService.findOne(userID).then((data) => ({ data }));
  }

  @ApiOperation({ summary: '查询所有用户', description: '查询所有用户' })
  @ApiOkResponse({
    type: QueryUserListVo,
    description: '查询所有用户',
  })
  @Get('queryAll')
  @HttpCode(HttpStatus.CREATED)
  async queryAllUser() {
    return this.userService.findAll().then((data) => ({ data }));
  }


}
